import enumMode from "../../em/enumMode"
import enumMesg from "../../em/enumMesg"
import enumCmds from "../../em/enumCmds"
import enumPatch from "../../em/enumPatch"
import supModule from "../../sup/supModule"
import wnetModule from "../../glo/wnetModule"
import infosModule from "../../glo/infosModule"

export default class loginModule extends supModule {
    private msgModule:wnetModule = this.getModule(enumMode.mesgeModule);
    private infModule:wnetModule = this.getModule(enumMode.mesgeModule);
    constructor(){
        super(enumMode.loginModule);
        this.portraitscreen();//竖屏模式
        this.settingnode(0);
        this.setSpanel(enumPatch.login);
    }

    public dispatchs(data:msgBody) {
        let cmd = data.cmds.pop()
        switch(cmd){
            case enumMesg.s2c_loginResult:{
                //保存账号数据
                infosModule.setData(cmd,data.info)
                //请求联盟数据
                this.msgModule.sendcmds([enumCmds.clubs,enumMesg.c2s_clubClubs])
                break
            }
            case enumMesg.s2c_clubClubs:{
                //保存联盟数据
                infosModule.setData(cmd,data.info)
                //切换到大厅场景
                let lobby:supModule = this.getModule(enumMode.lobbyModule)
                lobby.changeStart()
                break
            }
        }
    }
}